﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="LeftMenu.aspx.cs" Inherits="Whir_System_User_LeftMenu" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="Skin/Default/Css/css2.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="Js/extjs2/resources/css/ext-all.css" />

    <script type="text/javascript" src="Js/extjs2/adapter/ext/ext-base.js"></script>

    <script type="text/javascript" language="javascript" src="Js/extjs2/ext-all.js"></script>

    <script language="javascript" type="text/javascript">
        if (top.location == self.location) { 
            top.location='Default.aspx';
        } 
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div class="leftbox">
            <asp:Literal ID="litLogoImg" runat="server"></asp:Literal>
            <%--<img src="Skin/Default/images/logo.jpg" />--%><img src="Skin/Default/images/t1.jpg" /><div
                style="cursor: hand; position: relative; top: 0px; text-align: center">
                <img src="Skin/Default/images/arrowup.jpg" /></div>
            <div id="p2" style="overflow: hidden; height: 474px">
                <div id="tree-div" style="overflow: auto; width: 100%; height: 100%;">
                </div>
            </div>
            <div style="cursor: hand; position: relative; top: 0px; text-align: center">
                <img src="Skin/Default/images/arrowdown.jpg" /></div>
            <img src="Skin/Default/images/t_bottom1.jpg" /></div>

        <script type="text/javascript" language="javascript">

Ext.onReady(function(){

    Ext.BLANK_IMAGE_URL = "Js/extjs2/resources/images/default/s.gif"
    // shorthand
    var Tree = Ext.tree;
    
    var tree = new Tree.TreePanel({     
        el:'tree-div',
		autoScroll:true,
		root:root,
		animate:true,
		enableDD:false,
		border:false,
		rootVisible:true,
		containerScroll: true,
        loader: new Tree.TreeLoader({
            dataUrl:'getTreeData.aspx'
        })
    });

    // set the root node
    var root = new Tree.AsyncTreeNode({
        text: '网站导航',
        draggable:false,
        id:'source'
    });
    
    tree.setRootNode(root);

//----------------------------------------------------  
    //定义子节点的右键菜单
    var rightNodeClick = new Ext.menu.Menu({
        id :'rightNodeClick',
            items : [<%=menuBranchesCode %>]
    });

    //定义子节点的右键菜单
    var rightLeafClick = new Ext.menu.Menu({
        id :'rightLeafClick',
            items : [<%=menuLeavesCode %>]
    });

    //增加右键点击事件
    tree.on('contextmenu',function(node,event){//声明菜单类型
        event.preventDefault();//关闭默认的菜单，以避免弹出两个菜单 
        node.select();//选中点击的节点 
        selected = new Ext.tree.TreeNode({ 
            id:node.id, 
            text:node.text,
            leaf:node.leaf
        });
        if(node.isLeaf()){        
            rightLeafClick.showAt(event.getXY());//取得鼠标点击坐标，展示子节点菜单
        }else{
            rightNodeClick.showAt(event.getXY());//取得鼠标点击坐标，展示父级节点菜单
        }
    });  
    
//--------------------------------------------------

    // render the tree
    tree.render();
    root.expand();
});
        </script>
<iframe id="hideFrame" name="hideFrame" frameborder="0" width="0" height="0" src="about:blank"
    style="display: none;"></iframe>
    </form>
</body>
</html>
